/*
 * Copyright (C) 2011, EADS France
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 */

package xowl.interpreter.frontends;

import java.io.Writer;

/**
 *
 * @author Laurent WOUTERS
 */
public abstract class AbstractExpressionWriter {
    // <editor-fold defaultstate="collapsed" desc="Multityped expressions">
    protected abstract void writeValuesOf(Writer writer, xowl.lang.actions.ValuesOf query) throws java.io.IOException;
    protected abstract void writeValueOf(Writer writer, xowl.lang.actions.ValueOf query) throws java.io.IOException;
    protected abstract void writeContains(Writer writer, xowl.lang.actions.Contains query) throws java.io.IOException;
    protected abstract void writeInvoke(Writer writer, xowl.lang.actions.Invoke expression) throws java.io.IOException;
    protected abstract void writeExecute(Writer writer, xowl.lang.actions.Execute expression) throws java.io.IOException;
    protected abstract void writeQueryVariable(Writer writer, xowl.lang.actions.QueryVariable expression) throws java.io.IOException;
    protected abstract void writeCodeVariable(Writer writer, xowl.lang.actions.CodeVariable expression) throws java.io.IOException;
    protected abstract void writeArrayElement(Writer writer, xowl.lang.actions.ArrayElement expression) throws java.io.IOException;
    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="evalEntity">
    public void writeEntity(Writer writer, xowl.lang.owl2.EntityExpression expression) throws java.io.IOException {
        if (expression instanceof xowl.lang.actions.Invoke)
            writeInvoke(writer, (xowl.lang.actions.Invoke)expression);
        if (expression instanceof xowl.lang.actions.Execute)
            writeExecute(writer, (xowl.lang.actions.Execute)expression);
        if (expression instanceof xowl.lang.actions.ValueOf)
            writeValueOf(writer, (xowl.lang.actions.ValueOf)expression);
        if (expression instanceof xowl.lang.actions.CodeVariable)
            writeCodeVariable(writer, (xowl.lang.actions.CodeVariable)expression);
        if (expression instanceof xowl.lang.actions.QueryVariable)
            writeQueryVariable(writer, (xowl.lang.actions.QueryVariable)expression);
        if (expression instanceof xowl.lang.actions.ArrayElement)
            writeArrayElement(writer, (xowl.lang.actions.ArrayElement)expression);
        if (expression instanceof xowl.lang.interop.JavaInvokation)
            writeJavaInvokation(writer, (xowl.lang.interop.JavaInvokation)expression);
        if (expression instanceof xowl.lang.interop.ObjectField)
            writeObjectField(writer, (xowl.lang.interop.ObjectField)expression);
        if (expression instanceof xowl.lang.interop.StaticField)
            writeStaticField(writer, (xowl.lang.interop.StaticField)expression);
        if (expression instanceof xowl.lang.actions.NewEntity)
            writeNewEntity(writer, (xowl.lang.actions.NewEntity)expression);
        if (expression instanceof xowl.lang.actions.EntityForIRI)
            writeEntityForIRI(writer, (xowl.lang.actions.EntityForIRI)expression);
        if (expression instanceof xowl.lang.owl2.IRI) writeEntity(writer, (xowl.lang.owl2.IRI)expression);
    }
    protected abstract void writeEntity(Writer writer, xowl.lang.owl2.IRI expression) throws java.io.IOException;
    protected abstract void writeNewEntity(Writer writer, xowl.lang.actions.NewEntity expression) throws java.io.IOException;
    protected abstract void writeEntityForIRI(Writer writer, xowl.lang.actions.EntityForIRI expression) throws java.io.IOException;
    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="evalClass">
    public void writeClass(Writer writer, xowl.lang.owl2.ClassExpression expression) throws java.io.IOException {
        if (expression instanceof xowl.lang.actions.Invoke)
            writeInvoke(writer, (xowl.lang.actions.Invoke)expression);
        if (expression instanceof xowl.lang.actions.Execute)
            writeExecute(writer, (xowl.lang.actions.Execute)expression);
        if (expression instanceof xowl.lang.actions.ValueOf)
            writeValueOf(writer, (xowl.lang.actions.ValueOf)expression);
        if (expression instanceof xowl.lang.actions.CodeVariable)
            writeCodeVariable(writer, (xowl.lang.actions.CodeVariable)expression);
        if (expression instanceof xowl.lang.actions.QueryVariable)
            writeQueryVariable(writer, (xowl.lang.actions.QueryVariable)expression);
        if (expression instanceof xowl.lang.actions.ArrayElement)
            writeArrayElement(writer, (xowl.lang.actions.ArrayElement)expression);
        if (expression instanceof xowl.lang.interop.JavaInvokation)
            writeJavaInvokation(writer, (xowl.lang.interop.JavaInvokation)expression);
        if (expression instanceof xowl.lang.interop.ObjectField)
            writeObjectField(writer, (xowl.lang.interop.ObjectField)expression);
        if (expression instanceof xowl.lang.interop.StaticField)
            writeStaticField(writer, (xowl.lang.interop.StaticField)expression);
        if (expression instanceof xowl.lang.owl2.IRI) writeClass(writer, (xowl.lang.owl2.IRI)expression);
        if (expression instanceof xowl.lang.owl2.ObjectUnionOf) writeObjectUnionOf(writer, (xowl.lang.owl2.ObjectUnionOf)expression);
        if (expression instanceof xowl.lang.owl2.ObjectIntersectionOf) writeObjectIntersectionOf(writer, (xowl.lang.owl2.ObjectIntersectionOf)expression);
        if (expression instanceof xowl.lang.owl2.ObjectOneOf) writeObjectOneOf(writer, (xowl.lang.owl2.ObjectOneOf)expression);
        if (expression instanceof xowl.lang.owl2.ObjectComplementOf) writeObjectComplementOf(writer, (xowl.lang.owl2.ObjectComplementOf)expression);
        if (expression instanceof xowl.lang.owl2.DataAllValuesFrom) writeDataAllValuesFrom(writer, (xowl.lang.owl2.DataAllValuesFrom)expression);
        if (expression instanceof xowl.lang.owl2.DataExactCardinality) writeDataExactCardinality(writer, (xowl.lang.owl2.DataExactCardinality)expression);
        if (expression instanceof xowl.lang.owl2.DataHasValue) writeDataHasValue(writer, (xowl.lang.owl2.DataHasValue)expression);
        if (expression instanceof xowl.lang.owl2.DataMaxCardinality) writeDataMaxCardinality(writer, (xowl.lang.owl2.DataMaxCardinality)expression);
        if (expression instanceof xowl.lang.owl2.DataMinCardinality) writeDataMinCardinality(writer, (xowl.lang.owl2.DataMinCardinality)expression);
        if (expression instanceof xowl.lang.owl2.DataSomeValuesFrom) writeDataSomeValuesFrom(writer, (xowl.lang.owl2.DataSomeValuesFrom)expression);
        if (expression instanceof xowl.lang.owl2.ObjectAllValuesFrom) writeObjectAllValuesFrom(writer, (xowl.lang.owl2.ObjectAllValuesFrom)expression);
        if (expression instanceof xowl.lang.owl2.ObjectExactCardinality) writeObjectExactCardinality(writer, (xowl.lang.owl2.ObjectExactCardinality)expression);
        if (expression instanceof xowl.lang.owl2.ObjectHasSelf) writeObjectHasSelf(writer, (xowl.lang.owl2.ObjectHasSelf)expression);
        if (expression instanceof xowl.lang.owl2.ObjectHasValue) writeObjectHasValue(writer, (xowl.lang.owl2.ObjectHasValue)expression);
        if (expression instanceof xowl.lang.owl2.ObjectMaxCardinality) writeObjectMaxCardinality(writer, (xowl.lang.owl2.ObjectMaxCardinality)expression);
        if (expression instanceof xowl.lang.owl2.ObjectMinCardinality) writeObjectMinCardinality(writer, (xowl.lang.owl2.ObjectMinCardinality)expression);
        if (expression instanceof xowl.lang.owl2.ObjectSomeValuesFrom) writeObjectSomeValuesFrom(writer, (xowl.lang.owl2.ObjectSomeValuesFrom)expression);
    }
    protected abstract void writeClass(Writer writer, xowl.lang.owl2.IRI expression) throws java.io.IOException;
    protected abstract void writeObjectUnionOf(Writer writer, xowl.lang.owl2.ObjectUnionOf expression) throws java.io.IOException;
    protected abstract void writeObjectIntersectionOf(Writer writer, xowl.lang.owl2.ObjectIntersectionOf expression) throws java.io.IOException;
    protected abstract void writeObjectOneOf(Writer writer, xowl.lang.owl2.ObjectOneOf expression) throws java.io.IOException;
    protected abstract void writeObjectComplementOf(Writer writer, xowl.lang.owl2.ObjectComplementOf expression) throws java.io.IOException;
    protected abstract void writeDataAllValuesFrom(Writer writer, xowl.lang.owl2.DataAllValuesFrom expression) throws java.io.IOException;
    protected abstract void writeDataExactCardinality(Writer writer, xowl.lang.owl2.DataExactCardinality expression) throws java.io.IOException;
    protected abstract void writeDataHasValue(Writer writer, xowl.lang.owl2.DataHasValue expression) throws java.io.IOException;
    protected abstract void writeDataMaxCardinality(Writer writer, xowl.lang.owl2.DataMaxCardinality expression) throws java.io.IOException;
    protected abstract void writeDataMinCardinality(Writer writer, xowl.lang.owl2.DataMinCardinality expression) throws java.io.IOException;
    protected abstract void writeDataSomeValuesFrom(Writer writer, xowl.lang.owl2.DataSomeValuesFrom expression) throws java.io.IOException;
    protected abstract void writeObjectAllValuesFrom(Writer writer, xowl.lang.owl2.ObjectAllValuesFrom expression) throws java.io.IOException;
    protected abstract void writeObjectExactCardinality(Writer writer, xowl.lang.owl2.ObjectExactCardinality expression) throws java.io.IOException;
    protected abstract void writeObjectHasSelf(Writer writer, xowl.lang.owl2.ObjectHasSelf expression) throws java.io.IOException;
    protected abstract void writeObjectHasValue(Writer writer, xowl.lang.owl2.ObjectHasValue expression) throws java.io.IOException;
    protected abstract void writeObjectMaxCardinality(Writer writer, xowl.lang.owl2.ObjectMaxCardinality expression) throws java.io.IOException;
    protected abstract void writeObjectMinCardinality(Writer writer, xowl.lang.owl2.ObjectMinCardinality expression) throws java.io.IOException;
    protected abstract void writeObjectSomeValuesFrom(Writer writer, xowl.lang.owl2.ObjectSomeValuesFrom expression) throws java.io.IOException;
    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="evalObjProp">
    public void writeObjProp(Writer writer, xowl.lang.owl2.ObjectPropertyExpression expression) throws java.io.IOException {
        if (expression instanceof xowl.lang.actions.Invoke)
            writeInvoke(writer, (xowl.lang.actions.Invoke)expression);
        if (expression instanceof xowl.lang.actions.Execute)
            writeExecute(writer, (xowl.lang.actions.Execute)expression);
        if (expression instanceof xowl.lang.actions.ValueOf)
            writeValueOf(writer, (xowl.lang.actions.ValueOf)expression);
        if (expression instanceof xowl.lang.actions.CodeVariable)
            writeCodeVariable(writer, (xowl.lang.actions.CodeVariable)expression);
        if (expression instanceof xowl.lang.actions.QueryVariable)
            writeQueryVariable(writer, (xowl.lang.actions.QueryVariable)expression);
        if (expression instanceof xowl.lang.actions.ArrayElement)
            writeArrayElement(writer, (xowl.lang.actions.ArrayElement)expression);
        if (expression instanceof xowl.lang.interop.JavaInvokation)
            writeJavaInvokation(writer, (xowl.lang.interop.JavaInvokation)expression);
        if (expression instanceof xowl.lang.interop.ObjectField)
            writeObjectField(writer, (xowl.lang.interop.ObjectField)expression);
        if (expression instanceof xowl.lang.interop.StaticField)
            writeStaticField(writer, (xowl.lang.interop.StaticField)expression);
        if (expression instanceof xowl.lang.owl2.IRI) writeObjectProperty(writer, (xowl.lang.owl2.IRI)expression);
        if (expression instanceof xowl.lang.owl2.ObjectInverseOf) writeObjectInverseOf(writer, (xowl.lang.owl2.ObjectInverseOf)expression);
    }
    protected abstract void writeObjectProperty(Writer writer, xowl.lang.owl2.IRI expression) throws java.io.IOException;
    protected abstract void writeObjectInverseOf(Writer writer, xowl.lang.owl2.ObjectInverseOf expression) throws java.io.IOException;
    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="evalDataProp">
    public void writeDataProp(Writer writer, xowl.lang.owl2.DataPropertyExpression expression) throws java.io.IOException {
        if (expression instanceof xowl.lang.actions.Invoke)
            writeInvoke(writer, (xowl.lang.actions.Invoke)expression);
        if (expression instanceof xowl.lang.actions.Execute)
            writeExecute(writer, (xowl.lang.actions.Execute)expression);
        if (expression instanceof xowl.lang.actions.ValueOf)
            writeValueOf(writer, (xowl.lang.actions.ValueOf)expression);
        if (expression instanceof xowl.lang.actions.CodeVariable)
            writeCodeVariable(writer, (xowl.lang.actions.CodeVariable)expression);
        if (expression instanceof xowl.lang.actions.QueryVariable)
            writeQueryVariable(writer, (xowl.lang.actions.QueryVariable)expression);
        if (expression instanceof xowl.lang.actions.ArrayElement)
            writeArrayElement(writer, (xowl.lang.actions.ArrayElement)expression);
        if (expression instanceof xowl.lang.interop.JavaInvokation)
            writeJavaInvokation(writer, (xowl.lang.interop.JavaInvokation)expression);
        if (expression instanceof xowl.lang.interop.ObjectField)
            writeObjectField(writer, (xowl.lang.interop.ObjectField)expression);
        if (expression instanceof xowl.lang.interop.StaticField)
            writeStaticField(writer, (xowl.lang.interop.StaticField)expression);
        if (expression instanceof xowl.lang.owl2.IRI) writeDataProperty(writer, (xowl.lang.owl2.IRI)expression);
    }
    protected abstract void writeDataProperty(Writer writer, xowl.lang.owl2.IRI expression) throws java.io.IOException;
    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="evalDatatype">
    public void writeDatatype(Writer writer, xowl.lang.owl2.Datarange expression) throws java.io.IOException {
        if (expression instanceof xowl.lang.actions.Invoke)
            writeInvoke(writer, (xowl.lang.actions.Invoke)expression);
        if (expression instanceof xowl.lang.actions.Execute)
            writeExecute(writer, (xowl.lang.actions.Execute)expression);
        if (expression instanceof xowl.lang.actions.ValueOf)
            writeValueOf(writer, (xowl.lang.actions.ValueOf)expression);
        if (expression instanceof xowl.lang.actions.CodeVariable)
            writeCodeVariable(writer, (xowl.lang.actions.CodeVariable)expression);
        if (expression instanceof xowl.lang.actions.QueryVariable)
            writeQueryVariable(writer, (xowl.lang.actions.QueryVariable)expression);
        if (expression instanceof xowl.lang.actions.ArrayElement)
            writeArrayElement(writer, (xowl.lang.actions.ArrayElement)expression);
        if (expression instanceof xowl.lang.interop.JavaInvokation)
            writeJavaInvokation(writer, (xowl.lang.interop.JavaInvokation)expression);
        if (expression instanceof xowl.lang.interop.ObjectField)
            writeObjectField(writer, (xowl.lang.interop.ObjectField)expression);
        if (expression instanceof xowl.lang.interop.StaticField)
            writeStaticField(writer, (xowl.lang.interop.StaticField)expression);
        if (expression instanceof xowl.lang.owl2.IRI) writeDatatype(writer, (xowl.lang.owl2.IRI)expression);
        if (expression instanceof xowl.lang.owl2.DataComplementOf) writeDataComplementOf(writer, (xowl.lang.owl2.DataComplementOf)expression);
        if (expression instanceof xowl.lang.owl2.DataIntersectionOf) writeDataIntersectionOf(writer, (xowl.lang.owl2.DataIntersectionOf)expression);
        if (expression instanceof xowl.lang.owl2.DataOneOf) writeDataOneOf(writer, (xowl.lang.owl2.DataOneOf)expression);
        if (expression instanceof xowl.lang.owl2.DatatypeRestriction) writeDatatypeRestriction(writer, (xowl.lang.owl2.DatatypeRestriction)expression);
        if (expression instanceof xowl.lang.owl2.DataUnionOf) writeDataUnionOf(writer, (xowl.lang.owl2.DataUnionOf)expression);
    }
    protected abstract void writeDatatype(Writer writer, xowl.lang.owl2.IRI expression) throws java.io.IOException;
    protected abstract void writeDataComplementOf(Writer writer, xowl.lang.owl2.DataComplementOf expression) throws java.io.IOException;
    protected abstract void writeDataIntersectionOf(Writer writer, xowl.lang.owl2.DataIntersectionOf expression) throws java.io.IOException;
    protected abstract void writeDataOneOf(Writer writer, xowl.lang.owl2.DataOneOf expression) throws java.io.IOException;
    protected abstract void writeDatatypeRestriction(Writer writer, xowl.lang.owl2.DatatypeRestriction expression) throws java.io.IOException;
    protected abstract void writeDataUnionOf(Writer writer, xowl.lang.owl2.DataUnionOf expression) throws java.io.IOException;
    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="evalIndividual">
    public void writeIndividual(Writer writer, xowl.lang.owl2.IndividualExpression expression) throws java.io.IOException {
        if (expression instanceof xowl.lang.actions.Invoke)
            writeInvoke(writer, (xowl.lang.actions.Invoke)expression);
        if (expression instanceof xowl.lang.actions.Execute)
            writeExecute(writer, (xowl.lang.actions.Execute)expression);
        if (expression instanceof xowl.lang.actions.ValueOf)
            writeValueOf(writer, (xowl.lang.actions.ValueOf)expression);
        if (expression instanceof xowl.lang.actions.CodeVariable)
            writeCodeVariable(writer, (xowl.lang.actions.CodeVariable)expression);
        if (expression instanceof xowl.lang.actions.QueryVariable)
            writeQueryVariable(writer, (xowl.lang.actions.QueryVariable)expression);
        if (expression instanceof xowl.lang.actions.ArrayElement)
            writeArrayElement(writer, (xowl.lang.actions.ArrayElement)expression);
        if (expression instanceof xowl.lang.interop.JavaInvokation)
            writeJavaInvokation(writer, (xowl.lang.interop.JavaInvokation)expression);
        if (expression instanceof xowl.lang.interop.ObjectField)
            writeObjectField(writer, (xowl.lang.interop.ObjectField)expression);
        if (expression instanceof xowl.lang.interop.StaticField)
            writeStaticField(writer, (xowl.lang.interop.StaticField)expression);
        if (expression instanceof xowl.lang.actions.NewIndividual)
            writeNewIndividual(writer, (xowl.lang.actions.NewIndividual)expression);
        if (expression instanceof xowl.lang.owl2.IRI) writeNamedIndividual(writer, (xowl.lang.owl2.IRI)expression);
        if (expression instanceof xowl.lang.owl2.AnonymousIndividual) writeAnonymousIndividual(writer, (xowl.lang.owl2.AnonymousIndividual)expression);
    }
    protected abstract void writeNamedIndividual(Writer writer, xowl.lang.owl2.IRI expression) throws java.io.IOException;
    protected abstract void writeAnonymousIndividual(Writer writer, xowl.lang.owl2.AnonymousIndividual expression) throws java.io.IOException;
    protected abstract void writeNewIndividual(Writer writer, xowl.lang.actions.NewIndividual expression) throws java.io.IOException;
    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="evalLiteral">
    public void writeLiteral(Writer writer, xowl.lang.owl2.LiteralExpression expression) throws java.io.IOException {
        if (expression instanceof xowl.lang.actions.Invoke)
            writeInvoke(writer, (xowl.lang.actions.Invoke)expression);
        if (expression instanceof xowl.lang.actions.Execute)
            writeExecute(writer, (xowl.lang.actions.Execute)expression);
        if (expression instanceof xowl.lang.actions.Contains)
            writeContains(writer, (xowl.lang.actions.Contains)expression);
        if (expression instanceof xowl.lang.actions.ValueOf)
            writeValueOf(writer, (xowl.lang.actions.ValueOf)expression);
        if (expression instanceof xowl.lang.actions.CodeVariable)
            writeCodeVariable(writer, (xowl.lang.actions.CodeVariable)expression);
        if (expression instanceof xowl.lang.actions.QueryVariable)
            writeQueryVariable(writer, (xowl.lang.actions.QueryVariable)expression);
        if (expression instanceof xowl.lang.actions.ArrayElement)
            writeArrayElement(writer, (xowl.lang.actions.ArrayElement)expression);
        if (expression instanceof xowl.lang.interop.JavaInvokation)
            writeJavaInvokation(writer, (xowl.lang.interop.JavaInvokation)expression);
        if (expression instanceof xowl.lang.interop.ObjectField)
            writeObjectField(writer, (xowl.lang.interop.ObjectField)expression);
        if (expression instanceof xowl.lang.interop.StaticField)
            writeStaticField(writer, (xowl.lang.interop.StaticField)expression);
        if (expression instanceof xowl.lang.actions.Plus)
            writePlus(writer, (xowl.lang.actions.Plus)expression);
        if (expression instanceof xowl.lang.actions.Minus)
            writeMinus(writer, (xowl.lang.actions.Minus)expression);
        if (expression instanceof xowl.lang.actions.Mult)
            writeMult(writer, (xowl.lang.actions.Mult)expression);
        if (expression instanceof xowl.lang.actions.Divide)
            writeDivide(writer, (xowl.lang.actions.Divide)expression);
        if (expression instanceof xowl.lang.actions.Modulus)
            writeModulus(writer, (xowl.lang.actions.Modulus)expression);
        if (expression instanceof xowl.lang.actions.BAnd)
            writeBAnd(writer, (xowl.lang.actions.BAnd)expression);
        if (expression instanceof xowl.lang.actions.BOr)
            writeBOr(writer, (xowl.lang.actions.BOr)expression);
        if (expression instanceof xowl.lang.actions.BXOr)
            writeBXOr(writer, (xowl.lang.actions.BXOr)expression);
        if (expression instanceof xowl.lang.actions.BNot)
            writeBNot(writer, (xowl.lang.actions.BNot)expression);
        if (expression instanceof xowl.lang.actions.Equal)
            writeEqual(writer, (xowl.lang.actions.Equal)expression);
        if (expression instanceof xowl.lang.actions.Different)
            writeDifferent(writer, (xowl.lang.actions.Different)expression);
        if (expression instanceof xowl.lang.actions.Greater)
            writeGreater(writer, (xowl.lang.actions.Greater)expression);
        if (expression instanceof xowl.lang.actions.GreaterEqual)
            writeGreaterEqual(writer, (xowl.lang.actions.GreaterEqual)expression);
        if (expression instanceof xowl.lang.actions.Lesser)
            writeLesser(writer, (xowl.lang.actions.Lesser)expression);
        if (expression instanceof xowl.lang.actions.LesserEqual)
            writeLesserEqual(writer, (xowl.lang.actions.LesserEqual)expression);
        if (expression instanceof xowl.lang.actions.IRIOf)
            writeIRIOf(writer, (xowl.lang.actions.IRIOf)expression);
        if (expression instanceof xowl.lang.actions.LengthOf)
            writeLengthOf(writer, (xowl.lang.actions.LengthOf)expression);
        if (expression instanceof xowl.lang.owl2.Literal) writeLiteral(writer, (xowl.lang.owl2.Literal)expression);
    }
    protected abstract void writeLiteral(Writer writer, xowl.lang.owl2.Literal expression) throws java.io.IOException;
    protected abstract void writePlus(Writer writer, xowl.lang.actions.Plus expression) throws java.io.IOException;
    protected abstract void writeMinus(Writer writer, xowl.lang.actions.Minus expression) throws java.io.IOException;
    protected abstract void writeMult(Writer writer, xowl.lang.actions.Mult expression) throws java.io.IOException;
    protected abstract void writeDivide(Writer writer, xowl.lang.actions.Divide expression) throws java.io.IOException;
    protected abstract void writeModulus(Writer writer, xowl.lang.actions.Modulus expression) throws java.io.IOException;
    protected abstract void writeBAnd(Writer writer, xowl.lang.actions.BAnd expression) throws java.io.IOException;
    protected abstract void writeBOr(Writer writer, xowl.lang.actions.BOr expression) throws java.io.IOException;
    protected abstract void writeBXOr(Writer writer, xowl.lang.actions.BXOr expression) throws java.io.IOException;
    protected abstract void writeBNot(Writer writer, xowl.lang.actions.BNot expression) throws java.io.IOException;
    protected abstract void writeEqual(Writer writer, xowl.lang.actions.Equal expression) throws java.io.IOException;
    protected abstract void writeDifferent(Writer writer, xowl.lang.actions.Different expression) throws java.io.IOException;
    protected abstract void writeGreater(Writer writer, xowl.lang.actions.Greater expression) throws java.io.IOException;
    protected abstract void writeGreaterEqual(Writer writer, xowl.lang.actions.GreaterEqual expression) throws java.io.IOException;
    protected abstract void writeLesser(Writer writer, xowl.lang.actions.Lesser expression) throws java.io.IOException;
    protected abstract void writeLesserEqual(Writer writer, xowl.lang.actions.LesserEqual expression) throws java.io.IOException;
    protected abstract void writeIRIOf(Writer writer, xowl.lang.actions.IRIOf expression) throws java.io.IOException;
    protected abstract void writeLengthOf(Writer writer, xowl.lang.actions.LengthOf expression) throws java.io.IOException;
    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="evalFunction">
    public void writeFunction(Writer writer, xowl.lang.actions.FunctionExpression expression) throws java.io.IOException {
        if (expression instanceof xowl.lang.actions.Invoke)
            writeInvoke(writer, (xowl.lang.actions.Invoke)expression);
        if (expression instanceof xowl.lang.actions.Execute)
            writeExecute(writer, (xowl.lang.actions.Execute)expression);
        if (expression instanceof xowl.lang.actions.ValueOf)
            writeValueOf(writer, (xowl.lang.actions.ValueOf)expression);
        if (expression instanceof xowl.lang.actions.CodeVariable)
            writeCodeVariable(writer, (xowl.lang.actions.CodeVariable)expression);
        if (expression instanceof xowl.lang.actions.QueryVariable)
            writeQueryVariable(writer, (xowl.lang.actions.QueryVariable)expression);
        if (expression instanceof xowl.lang.actions.ArrayElement)
            writeArrayElement(writer, (xowl.lang.actions.ArrayElement)expression);
        if (expression instanceof xowl.lang.interop.JavaInvokation)
            writeJavaInvokation(writer, (xowl.lang.interop.JavaInvokation)expression);
        if (expression instanceof xowl.lang.interop.ObjectField)
            writeObjectField(writer, (xowl.lang.interop.ObjectField)expression);
        if (expression instanceof xowl.lang.interop.StaticField)
            writeStaticField(writer, (xowl.lang.interop.StaticField)expression);
        if (expression instanceof xowl.lang.owl2.IRI) writeFunction(writer, (xowl.lang.owl2.IRI)expression);
    }
    protected abstract void writeFunction(Writer writer, xowl.lang.owl2.IRI expression) throws java.io.IOException;
    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="evalClosure">
    public void writeClosure(Writer writer, xowl.lang.actions.ExecutableExpression expression) throws java.io.IOException {
        if (expression instanceof xowl.lang.actions.Invoke)
            writeInvoke(writer, (xowl.lang.actions.Invoke)expression);
        if (expression instanceof xowl.lang.actions.Execute)
            writeExecute(writer, (xowl.lang.actions.Execute)expression);
        if (expression instanceof xowl.lang.actions.ValueOf)
            writeValueOf(writer, (xowl.lang.actions.ValueOf)expression);
        if (expression instanceof xowl.lang.actions.CodeVariable)
            writeCodeVariable(writer, (xowl.lang.actions.CodeVariable)expression);
        if (expression instanceof xowl.lang.actions.QueryVariable)
            writeQueryVariable(writer, (xowl.lang.actions.QueryVariable)expression);
        if (expression instanceof xowl.lang.actions.ArrayElement)
            writeArrayElement(writer, (xowl.lang.actions.ArrayElement)expression);
        if (expression instanceof xowl.lang.interop.JavaInvokation)
            writeJavaInvokation(writer, (xowl.lang.interop.JavaInvokation)expression);
        if (expression instanceof xowl.lang.interop.ObjectField)
            writeObjectField(writer, (xowl.lang.interop.ObjectField)expression);
        if (expression instanceof xowl.lang.interop.StaticField)
            writeStaticField(writer, (xowl.lang.interop.StaticField)expression);
        if (expression instanceof xowl.lang.actions.Lambda)
            writeLambda(writer, (xowl.lang.actions.Lambda)expression);
    }
    protected abstract void writeLambda(Writer writer, xowl.lang.actions.Lambda expression) throws java.io.IOException;
    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="evalArray">
    public void writeArray(Writer writer, xowl.lang.actions.ArrayExpression expression) throws java.io.IOException {
        if (expression instanceof xowl.lang.actions.Invoke)
            writeInvoke(writer, (xowl.lang.actions.Invoke)expression);
        if (expression instanceof xowl.lang.actions.Execute)
            writeExecute(writer, (xowl.lang.actions.Execute)expression);
        if (expression instanceof xowl.lang.actions.ValuesOf)
            writeValuesOf(writer, (xowl.lang.actions.ValuesOf)expression);
        if (expression instanceof xowl.lang.actions.CodeVariable)
            writeCodeVariable(writer, (xowl.lang.actions.CodeVariable)expression);
        if (expression instanceof xowl.lang.actions.QueryVariable)
            writeQueryVariable(writer, (xowl.lang.actions.QueryVariable)expression);
        if (expression instanceof xowl.lang.actions.ArrayElement)
            writeArrayElement(writer, (xowl.lang.actions.ArrayElement)expression);
        if (expression instanceof xowl.lang.interop.JavaInvokation)
            writeJavaInvokation(writer, (xowl.lang.interop.JavaInvokation)expression);
        if (expression instanceof xowl.lang.interop.ObjectField)
            writeObjectField(writer, (xowl.lang.interop.ObjectField)expression);
        if (expression instanceof xowl.lang.interop.StaticField)
            writeStaticField(writer, (xowl.lang.interop.StaticField)expression);
        if (expression instanceof xowl.lang.actions.Array)
            writeArray(writer, (xowl.lang.actions.Array)expression);
        if (expression instanceof xowl.lang.actions.Concat)
            writeConcat(writer, (xowl.lang.actions.Concat)expression);
        if (expression instanceof xowl.lang.actions.Slice)
            writeSlice(writer, (xowl.lang.actions.Slice)expression);
    }
    protected abstract void writeArray(Writer writer, xowl.lang.actions.Array expression) throws java.io.IOException;
    protected abstract void writeConcat(Writer writer, xowl.lang.actions.Concat expression) throws java.io.IOException;
    protected abstract void writeSlice(Writer writer, xowl.lang.actions.Slice expression) throws java.io.IOException;
    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="evalJavaObject">
    public void writeJavaObject(Writer writer, xowl.lang.interop.JavaObjectExpression expression) throws java.io.IOException {
        if (expression instanceof xowl.lang.actions.Invoke)
            writeInvoke(writer, (xowl.lang.actions.Invoke)expression);
        if (expression instanceof xowl.lang.actions.Execute)
            writeExecute(writer, (xowl.lang.actions.Execute)expression);
        if (expression instanceof xowl.lang.actions.CodeVariable)
            writeCodeVariable(writer, (xowl.lang.actions.CodeVariable)expression);
        if (expression instanceof xowl.lang.interop.JavaInvokation)
            writeJavaInvokation(writer, (xowl.lang.interop.JavaInvokation)expression);
        if (expression instanceof xowl.lang.interop.NewObject)
            writeNewObject(writer, (xowl.lang.interop.NewObject)expression);
        if (expression instanceof xowl.lang.interop.ObjectField)
            writeObjectField(writer, (xowl.lang.interop.ObjectField)expression);
        if (expression instanceof xowl.lang.interop.StaticField)
            writeStaticField(writer, (xowl.lang.interop.StaticField)expression);
    }
    protected abstract void writeJavaInvokation(Writer writer, xowl.lang.interop.JavaInvokation expression) throws java.io.IOException;
    protected abstract void writeNewObject(Writer writer, xowl.lang.interop.NewObject expression) throws java.io.IOException;
    protected abstract void writeObjectField(Writer writer, xowl.lang.interop.ObjectField expression) throws java.io.IOException;
    protected abstract void writeStaticField(Writer writer, xowl.lang.interop.StaticField expression) throws java.io.IOException;
    // </editor-fold>

    public void write(Writer writer, xowl.lang.owl2.Expression expression) throws java.io.IOException {
        if (expression instanceof xowl.lang.actions.Invoke) writeInvoke(writer, (xowl.lang.actions.Invoke)expression);
        if (expression instanceof xowl.lang.actions.Execute) writeExecute(writer, (xowl.lang.actions.Execute)expression);
        if (expression instanceof xowl.lang.actions.Contains) writeContains(writer, (xowl.lang.actions.Contains)expression);
        if (expression instanceof xowl.lang.actions.ValueOf) writeValueOf(writer, (xowl.lang.actions.ValueOf)expression);
        if (expression instanceof xowl.lang.actions.ValuesOf) writeValuesOf(writer, (xowl.lang.actions.ValuesOf)expression);
        if (expression instanceof xowl.lang.actions.CodeVariable) writeCodeVariable(writer, (xowl.lang.actions.CodeVariable)expression);
        if (expression instanceof xowl.lang.actions.QueryVariable) writeQueryVariable(writer, (xowl.lang.actions.QueryVariable)expression);
        if (expression instanceof xowl.lang.actions.ArrayElement) writeArrayElement(writer, (xowl.lang.actions.ArrayElement)expression);
        if (expression instanceof xowl.lang.interop.JavaInvokation) writeJavaInvokation(writer, (xowl.lang.interop.JavaInvokation)expression);
        if (expression instanceof xowl.lang.interop.ObjectField) writeObjectField(writer, (xowl.lang.interop.ObjectField)expression);
        if (expression instanceof xowl.lang.interop.StaticField) writeStaticField(writer, (xowl.lang.interop.StaticField)expression);
        if (expression instanceof xowl.lang.owl2.EntityExpression)
            writeEntity(writer, (xowl.lang.owl2.EntityExpression)expression);
        if (expression instanceof xowl.lang.owl2.ClassExpression)
            writeClass(writer, (xowl.lang.owl2.ClassExpression)expression);
        if (expression instanceof xowl.lang.owl2.ObjectPropertyExpression)
            writeObjProp(writer, (xowl.lang.owl2.ObjectPropertyExpression)expression);
        if (expression instanceof xowl.lang.owl2.DataPropertyExpression)
            writeDataProp(writer, (xowl.lang.owl2.DataPropertyExpression)expression);
        if (expression instanceof xowl.lang.owl2.Datarange)
            writeDatatype(writer, (xowl.lang.owl2.Datarange)expression);
        if (expression instanceof xowl.lang.owl2.IndividualExpression)
            writeIndividual(writer, (xowl.lang.owl2.IndividualExpression)expression);
        if (expression instanceof xowl.lang.owl2.LiteralExpression)
            writeLiteral(writer, (xowl.lang.owl2.LiteralExpression)expression);
        if (expression instanceof xowl.lang.actions.FunctionExpression)
            writeFunction(writer, (xowl.lang.actions.FunctionExpression)expression);
        if (expression instanceof xowl.lang.actions.ExecutableExpression)
            writeClosure(writer, (xowl.lang.actions.ExecutableExpression)expression);
        if (expression instanceof xowl.lang.actions.ArrayExpression)
            writeArray(writer, (xowl.lang.actions.ArrayExpression)expression);
        if (expression instanceof xowl.lang.interop.JavaObjectExpression)
            writeJavaObject(writer, (xowl.lang.interop.JavaObjectExpression)expression);
    }
}
